
import axios from 'axios';
import Vue from 'vue'
const Bus = new Vue();
const domain = '';
const urlEncode = (json) => {  
    return Object.keys(json).map(function (key) {
        return encodeURIComponent(key) + "=" + encodeURIComponent(json[key]);
    }).join("&"); 
};

export const getReq = (url='', param={}) => {
    Bus.$Spin.show();
    let reqUrl = domain+url+urlEncode(param)
    return axios.get(reqUrl, {
        headers: {
            //'withCredentials': true,
            // 'crossDomain': true,
            // 'Content-Type': 'application/x-www-form-urlencoded',
        },
        // withCredentials: true
    }).then(response => {
        Bus.$Spin.hide();
        return response.data
    })
}